WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::StateBlock Class Referenceabstract

State block: a state vector of a variable of the nonlinear optimization. More...

#include <core/state_block/state_block.h>

Inheritance diagram for wolf::StateBlock:
[legend]

Public Member Functions

 StateBlock (const std::string &_type, const SizeEigen _size, bool _fixed=false, LocalParametrizationBasePtr _local_param_ptr=nullptr, bool _transformable=true)
 Constructor from size. More...
 
 StateBlock (const std::string &_type, const Eigen::VectorXd &_state, bool _fixed=false, LocalParametrizationBasePtr _local_param_ptr=nullptr, bool _transformable=true)
 Constructor from vector. More...
 
 StateBlock (const StateBlock &o)=delete
 Not copyable. More...
 
 StateBlock (StateBlock &&o)=delete
 Not movable. More...
 
StateBlock & operator= (const StateBlock &o)=delete
 Not assignable. More...
 
virtual ~StateBlock ()
 Destructor. More...
 
std::string getType () const
 Returns the type of the state block. More...
 
Eigen::VectorXd getState () const
 Returns the state vector. More...
 
double * getStateData ()
 Returns the state vector data array. More...
 
void setState (const Eigen::VectorXd &_state, const bool _notify=true)
 Sets the state vector. More...
 
SizeEigen getSize () const
 Returns the state size. More...
 
SizeEigen getLocalSize () const
 Returns the size of the local parametrization. More...
 
bool isFixed () const
 Returns whether the state is fixed (not estimated) More...
 
void fix ()
 Sets the state as fixed. More...
 
void unfix ()
 Sets the state as estimated. More...
 
void setFixed (bool _fixed)
 Sets the state status. More...
 
bool hasLocalParametrization () const
 Returns whether the state has a local parametrization. More...
 
LocalParametrizationBasePtr getLocalParametrization () const
 Returns the state local parametrization ptr. More...
 
void setLocalParametrization (LocalParametrizationBasePtr _local_param)
 Sets a local parametrization. More...
 
void removeLocalParametrization ()
 Removes the state_block local parametrization. More...
 
bool stateUpdated () const
 Returns whether the state has been updated (to be notified to the solver) More...
 
bool fixUpdated () const
 Returns whether the fixed status has been updated (to be notified to the solver) More...
 
bool localParamUpdated () const
 Returns whether the local parametrization has been updated (to be notified to the solver) More...
 
void resetStateUpdated ()
 Resets the state updated flag. More...
 
void resetFixUpdated ()
 Resets the fixed status updated flag. More...
 
void resetLocalParamUpdated ()
 Resets the local parametrization updated flag. More...
 
virtual void setIdentity (bool _notify=true)
 Sets the state to the identity element. More...
 
void setZero (bool _notify=true)
 Sets the state to zero (the identity element) More...
 
virtual Eigen::VectorXd identity () const
 Returns the identity element of the state. More...
 
Eigen::VectorXd zero () const
 Returns the zero (identity) element of the state. More...
 
void perturb (double amplitude=0.1)
 Perturbs the state (if not fixed) with random noise following a uniform distribution in [-amplitude, amplitude] (in the tangent space) More...
 
bool isTransformable () const
 Returns whether the state block can be transformed to another reference frame. More...
 
void setTransformable (bool _trf=true)
 Sets whether the state block can be transformed to another reference frame. More...
 
void setNonTransformable ()
 Sets the state block as not transformable to another reference frame. More...
 
virtual void transform (const VectorComposite &_transformation)=0
 Transforms the state to another reference frame (if transformable) More...
 
void plus (const Eigen::VectorXd &_dv)
 Adds a (tangent) increment to the state, through the local parametrization if any. More...
 
bool isValid (double tolerance=Constants::EPS)
 Returns whether the state is valid according to its local parametrization (e.g. unit quaternion) More...
 

Protected Attributes

std::string type_
 Type of the derived class. More...
 
std::atomic_bool fixed_
 Flag to indicate whether the state is fixed or not. More...
 
std::atomic< SizeEigen > state_size_
 State vector size. More...
 
Eigen::VectorXd state_
 State vector storing the state values. More...
 
std::mutex mut_state_
 State vector mutex. More...
 
LocalParametrizationBasePtr local_param_ptr_
 Local parametrization (optimization in the tangent space) More...
 
std::atomic_bool state_updated_
 Flag to indicate whether the state has been updated or not. More...
 
std::atomic_bool fix_updated_
 Flag to indicate whether the status has been updated or not. More...
 
std::atomic_bool local_param_updated_
 Flag to indicate whether the local parametrization has been updated. More...
 
bool transformable_
 Flag to indicate if the state block can be transformed to another reference frame. More...
 

Detailed Description

State block: a state vector of a variable of the nonlinear optimization.

This class implements a state block for general nonlinear optimization. It offers the following functionality:

  • A state vector storing the state values.
  • A flag to indicate whether the state is fixed or not.
    • Fixed state blocks are not estimated and treated by the estimator as fixed parameters.
    • Non-fixed state blocks are estimated.
  • A local parametrization useful for optimizing in the tangent space to the manifold.

Constructor & Destructor Documentation

◆ StateBlock() [1/4]

wolf::StateBlock::StateBlock ( const std::string &  _type,
const SizeEigen  _size,
bool  _fixed = false,
LocalParametrizationBasePtr  _local_param_ptr = nullptr,
bool  _transformable = true 
)
inline

Constructor from size.

Parameters
_sizeis state size
_fixedIndicates this state is not estimated and thus acts as a fixed parameter
_local_param_ptrpointer to the local parametrization for the block

◆ StateBlock() [2/4]

wolf::StateBlock::StateBlock ( const std::string &  _type,
const Eigen::VectorXd &  _state,
bool  _fixed = false,
LocalParametrizationBasePtr  _local_param_ptr = nullptr,
bool  _transformable = true 
)
inline

Constructor from vector.

Parameters
_stateis state vector
_fixedIndicates this state is not estimated and thus acts as a fixed parameter
_local_param_ptrpointer to the local parametrization for the block

◆ StateBlock() [3/4]

wolf::StateBlock::StateBlock ( const StateBlock &  o)
delete

Not copyable.

◆ StateBlock() [4/4]

wolf::StateBlock::StateBlock ( StateBlock &&  o)
delete

Not movable.

◆ ~StateBlock()

wolf::StateBlock::~StateBlock ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ fix()

void wolf::StateBlock::fix ( )
inline

Sets the state as fixed.

◆ fixUpdated()

bool wolf::StateBlock::fixUpdated ( ) const
inline

Returns whether the fixed status has been updated (to be notified to the solver)

◆ getLocalParametrization()

LocalParametrizationBasePtr wolf::StateBlock::getLocalParametrization ( ) const
inline

Returns the state local parametrization ptr.

◆ getLocalSize()

SizeEigen wolf::StateBlock::getLocalSize ( ) const
inline

Returns the size of the local parametrization.

◆ getSize()

SizeEigen wolf::StateBlock::getSize ( ) const
inline

Returns the state size.

◆ getState()

Eigen::VectorXd wolf::StateBlock::getState ( ) const
inline

Returns the state vector.

◆ getStateData()

double * wolf::StateBlock::getStateData ( )
inline

Returns the state vector data array.

◆ getType()

std::string wolf::StateBlock::getType ( ) const
inline

Returns the type of the state block.

◆ hasLocalParametrization()

bool wolf::StateBlock::hasLocalParametrization ( ) const
inline

Returns whether the state has a local parametrization.

◆ identity()

Eigen::VectorXd wolf::StateBlock::identity ( ) const
inlinevirtual

Returns the identity element of the state.

Reimplemented in wolf::StateHomogeneous3d, and wolf::StateQuaternion.

◆ isFixed()

bool wolf::StateBlock::isFixed ( ) const
inline

Returns whether the state is fixed (not estimated)

◆ isTransformable()

bool wolf::StateBlock::isTransformable ( ) const
inline

Returns whether the state block can be transformed to another reference frame.

◆ isValid()

bool wolf::StateBlock::isValid ( double  tolerance = Constants::EPS)
inline

Returns whether the state is valid according to its local parametrization (e.g. unit quaternion)

◆ localParamUpdated()

bool wolf::StateBlock::localParamUpdated ( ) const
inline

Returns whether the local parametrization has been updated (to be notified to the solver)

◆ operator=()

StateBlock & wolf::StateBlock::operator= ( const StateBlock &  o)
delete

Not assignable.

◆ perturb()

void wolf::StateBlock::perturb ( double  amplitude = 0.1)

Perturbs the state (if not fixed) with random noise following a uniform distribution in [-amplitude, amplitude] (in the tangent space)

◆ plus()

void wolf::StateBlock::plus ( const Eigen::VectorXd &  _dv)

Adds a (tangent) increment to the state, through the local parametrization if any.

◆ removeLocalParametrization()

void wolf::StateBlock::removeLocalParametrization ( )
inline

Removes the state_block local parametrization.

◆ resetFixUpdated()

void wolf::StateBlock::resetFixUpdated ( )
inline

Resets the fixed status updated flag.

◆ resetLocalParamUpdated()

void wolf::StateBlock::resetLocalParamUpdated ( )
inline

Resets the local parametrization updated flag.

◆ resetStateUpdated()

void wolf::StateBlock::resetStateUpdated ( )
inline

Resets the state updated flag.

◆ setFixed()

void wolf::StateBlock::setFixed ( bool  _fixed)

Sets the state status.

◆ setIdentity()

void wolf::StateBlock::setIdentity ( bool  _notify = true)
inlinevirtual

Sets the state to the identity element.

Reimplemented in wolf::StateHomogeneous3d, and wolf::StateQuaternion.

◆ setLocalParametrization()

void wolf::StateBlock::setLocalParametrization ( LocalParametrizationBasePtr  _local_param)
inline

Sets a local parametrization.

◆ setNonTransformable()

void wolf::StateBlock::setNonTransformable ( )
inline

Sets the state block as not transformable to another reference frame.

◆ setState()

void wolf::StateBlock::setState ( const Eigen::VectorXd &  _state,
const bool  _notify = true 
)

Sets the state vector.

◆ setTransformable()

void wolf::StateBlock::setTransformable ( bool  _trf = true)
inline

Sets whether the state block can be transformed to another reference frame.

◆ setZero()

void wolf::StateBlock::setZero ( bool  _notify = true)
inline

Sets the state to zero (the identity element)

◆ stateUpdated()

bool wolf::StateBlock::stateUpdated ( ) const
inline

Returns whether the state has been updated (to be notified to the solver)

◆ transform()

virtual void wolf::StateBlock::transform ( const VectorComposite &  _transformation)
pure virtual

◆ unfix()

void wolf::StateBlock::unfix ( )
inline

Sets the state as estimated.

◆ zero()

Eigen::VectorXd wolf::StateBlock::zero ( ) const
inline

Returns the zero (identity) element of the state.

Member Data Documentation

◆ fix_updated_

std::atomic_bool wolf::StateBlock::fix_updated_
protected

Flag to indicate whether the status has been updated or not.

◆ fixed_

std::atomic_bool wolf::StateBlock::fixed_
protected

Flag to indicate whether the state is fixed or not.

◆ local_param_ptr_

LocalParametrizationBasePtr wolf::StateBlock::local_param_ptr_
protected

Local parametrization (optimization in the tangent space)

◆ local_param_updated_

std::atomic_bool wolf::StateBlock::local_param_updated_
protected

Flag to indicate whether the local parametrization has been updated.

◆ mut_state_

std::mutex wolf::StateBlock::mut_state_
mutableprotected

State vector mutex.

◆ state_

Eigen::VectorXd wolf::StateBlock::state_
protected

State vector storing the state values.

◆ state_size_

std::atomic<SizeEigen> wolf::StateBlock::state_size_
protected

State vector size.

◆ state_updated_

std::atomic_bool wolf::StateBlock::state_updated_
protected

Flag to indicate whether the state has been updated or not.

◆ transformable_

bool wolf::StateBlock::transformable_
protected

Flag to indicate if the state block can be transformed to another reference frame.

◆ type_

std::string wolf::StateBlock::type_
protected

Type of the derived class.


The documentation for this class was generated from the following files: